package com.qcby.byc.demo0422.entity;

import com.qcby.byc.demo0422.controller.Demo0528Controller;
import lombok.extern.slf4j.Slf4j;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

/**
 * @className: DateThread
 * @description:
 * @author: lxt
 * @create: 2021-05-28 15:30
 **/
@Slf4j
public class DateThread extends Thread{
    private int date;
    private SimpleDateFormat sdf;

    public DateThread(SimpleDateFormat sdf,int date) {
        this.date = date;
        this.sdf = sdf;
    }
    @Override
    public void run() {
//        sdfFormat();
        timeFormat();
    }
    public void sdfFormat(){
        DateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
            try {
            Date date = dateFormat1.parse("2021-05-"+this.date);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            log.info("2021-05-"+this.date+":"+ Demo0528Controller.format(sdf,date));
        } catch (ParseException e) {
            e.printStackTrace();
        }

    }

    public void timeFormat(){
        LocalDate localDate = LocalDate.of(2021,5,this.date);
        log.info("2021-05-"+this.date+":"+ Demo0528Controller.format(localDate));
    }
}
